package com.eco.fanliapp.admin.controller.web;

import com.eco.fanliapp.admin.annotation.SysLogAnnotation;
import com.eco.fanliapp.admin.common.BaseController;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.service.IAmountOfMoneyService;
import com.eco.fanliapp.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * @date 2019-08-26
 */
@RestController
@RequestMapping("/web/data")
public class WebAmountOfMoneyController extends BaseController {

    @Autowired
    private IAmountOfMoneyService iAmountOfMoneyService;

    /**
     * 统计总额，昨日金额数据1昨日总额，0总额
     * @return
     */
//    @SysLogAnnotation(value = "红包金额统计",userType = 2)
    @GetMapping("/statistics/otherMoney")
    public ServerResponse selectMoneyList(){
        UserVO userVO = getAuthentication();
        Integer companyId = null;
        if(userVO.getCompanyId() != 0){
            companyId = userVO.getCompanyId();
        }
        return iAmountOfMoneyService.selectMoneyList(companyId);
    }
    /**
     * 下载30天金额数据
     * @return
     */
    @GetMapping("/statistics/cashDownload")
    @ResponseBody
    public ServerResponse getCashDownload(HttpServletResponse response){
        return iAmountOfMoneyService.getCashDownload(response);
    }
}
